home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <proto/exec.h>
- #include <intuition/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <proto/intuition.h>
- #include <libraries/gadtools.h>
- #include <proto/gadtools.h>
-
- #define ALL_REACTION_CLASSES
- #define ALL_REACTION_MACROS
- #include <reaction/reaction.h>
- #include <gadgets/texteditor.h>
- #include <clib/texteditor_protos.h>
- #include <pragmas/texteditor_pragmas.h>
-
- #include <ctype.h>
- #include <stdlib.h>
- #include <string.h>
- #include "rp.h"
-
- IMPORT struct AminetStruct aminet;
- AGLOBAL struct AGDBStruct agdb;
-
- #define GID_11_TE1 0
- #define GIDS_11 GID_11_TE1
-
- // from rp.c
- IMPORT SBYTE page;
- IMPORT struct NewGadget Gadget;
- IMPORT struct Gadget *BU99_Right,
- *BU99_TextEditor,
- *PrevGadPtr;
- IMPORT struct Window* MainWindowPtr;
- IMPORT struct SharedStruct shared;
- IMPORT ULONG offset;
- IMPORT TEXT IOBuffer[LONGESTFIELD + 1],
- aslresult[MEDFIELD + 1],
- string[VLONGFIELD + 1];
- IMPORT ABOOL fillwindows;
- IMPORT struct Library* TextEditorBase;
-
- MODULE void updateagdbgadgets(void);
- MODULE void readagdbgadgets(void);
-
- MODULE struct Gadget *ST111_Title = NULL,
- *ST111_Publisher = NULL,
- *ST111_GameType = NULL,
- *ST111_Players = NULL,
- *ST111_HDInstallable = NULL,
- *ST111_Compatibility = NULL,
- *ST111_Submission = NULL,
- *TE111_Review = NULL,
- *gadgets[GIDS_11 + 1];
-
- AGLOBAL void agdb1(void)
- { verynewwindow
- ( AGDBWIDTH, AGDBHEIGHT,
- "Report+: Amiga Games Database (AGDB) Review Details",
- BUTTONIDCMP | STRINGIDCMP
- );
- OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_NEW, NOSUB));
- OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_OPEN, NOSUB));
- OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVE, NOSUB));
- OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVEAS, NOSUB));
-
- /* PAGE 111 ************************************************************/
-
- if (!(gadgets[GID_11_TE1] = (struct Gadget *) NewObject
- ( TEXTEDITOR_GetClass(), NULL,
- GA_ID, GID_11_TE1,
- GA_Left, 10,
- GA_Top, 130,
- GA_Width, AGDBWIDTH - 20,
- GA_Height, 100,
- GA_RelVerify, TRUE,
- GA_TEXTEDITOR_ExportWrap, 75,
- TAG_END
- )))
- { rq("Can't create ReAction gadgets!");
- }
- SetGadgetAttrs
- ( gadgets[GID_11_TE1], MainWindowPtr, NULL,
- GA_TEXTEDITOR_Contents, aminet.textfield
- ); // long description
-
- AddGList(MainWindowPtr, gadgets[GID_11_TE1], -1, -1, NULL);
- RefreshGList(gadgets[GID_11_TE1], MainWindowPtr, NULL, -1);
-
- setgadget(10, 130, AGDBWIDTH - 20, 1, "_Review:", PLACETEXT_ABOVE);
- TE111_Review = PrevGadPtr = (struct Gadget *) CreateGadget
- ( TEXT_KIND,
- PrevGadPtr,
- &Gadget,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- setgadget(168, 24, 330, 12, "_Title:", NULL);
- ST111_Title = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(agdb.title),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- setgadget(168, 36, 330, 12, "_Publisher (Year):", NULL);
- ST111_Publisher = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(agdb.publisher),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- setgadget(168, 48, 330, 12, "_Game Type:", NULL);
- ST111_GameType = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(agdb.gametype),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- setgadget(168, 60, 330, 12, "P_layers:", NULL);
- ST111_Players = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(agdb.players),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- setgadget(168, 72, 330, 12, "_HD Installable?", NULL);
- ST111_HDInstallable = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(agdb.hdinstallable),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- setgadget(168, 84, 330, 12, "_Compatibility:", NULL);
- ST111_Compatibility = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(agdb.compatibility),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- if ((!(aminet.uploader[0])) && readin("S:Report.sender"))
- { /* # Refer: <last>,<first> (<company> ,phone <phone>)<LF>
- # Path: <email><LF>
- # ReferID: <developer><LF> */
-
- offset = 0;
- parse("# Refer: ");
- parse(",");
- parse(" (");
- parse(" ,phone ");
- parse(")\n# Path: ");
- parse("\n# ReferID: ");
- strcpy(aminet.uploader, string);
- }
-
- setgadget(168, 96, 330, 12, "_Submission:", NULL);
- ST111_Submission = PrevGadPtr = (struct Gadget *) CreateGadget
- ( STRING_KIND,
- PrevGadPtr,
- &Gadget,
- GTST_String, &(aminet.uploader),
- GTST_MaxChars, 40,
- GA_TabCycle, TRUE,
- GA_Immediate, TRUE,
- GT_Underscore, '_',
- TAG_DONE
- );
-
- drawgadgets((UWORD) ~0);
- ActivateGadget(ST111_Title, MainWindowPtr, NULL);
- loop();
- readagdbgadgets();
- closewindow();
- }
-
- AGLOBAL void saveagdb(ABOOL saveas)
- { /* Title <title>
- Publisher <publisher>
- Game Type <game type>
- Players <players>
- HD Installable <hd installable>
- Compatibility <compatibility>
- Submission <uploader>
-
- Review
- <review> */
-
- readagdbgadgets();
-
- strcpy(IOBuffer, "Title: ");
- strcat(IOBuffer, agdb.title);
- strcat(IOBuffer, "\nPublisher: ");
- strcat(IOBuffer, agdb.publisher);
- strcat(IOBuffer, "\nGame Type: ");
- strcat(IOBuffer, agdb.gametype);
- strcat(IOBuffer, "\nPlayers: ");
- strcat(IOBuffer, agdb.players);
- strcat(IOBuffer, "\nHD Installable: ");
- strcat(IOBuffer, agdb.hdinstallable);
- strcat(IOBuffer, "\nCompatibility: ");
- strcat(IOBuffer, agdb.compatibility);
- strcat(IOBuffer, "\nSubmission: ");
- strcat(IOBuffer, aminet.uploader);
- strcat(IOBuffer, "\n\nReview:\n");
- strcat(IOBuffer, agdb.textfield);
-
- if (!agdb.output[0] || saveas) // if we need a filename
- { if (saveasl("Save AGDB Review"))
- { strcpy(agdb.output, aslresult);
- writeout(agdb.output);
- } } }
-
- AGLOBAL void agdb_loop(ULONG class, struct Gadget* addr, UWORD code)
- { if (class == IDCMP_GADGETUP)
- { if (addr == BU99_Right)
- { page = 0;
- } elif (addr == BU99_TextEditor)
- { launcheditor(agdb.output);
- } }
- elif (class == IDCMP_VANILLAKEY)
- { code = toupper(code);
- if (code == ESCAPE)
- { page = 0;
- } elif (code == 'T')
- { ActivateGadget(ST111_Title, MainWindowPtr, NULL);
- } elif (code == 'P')
- { ActivateGadget(ST111_Publisher, MainWindowPtr, NULL);
- } elif (code == 'G')
- { ActivateGadget(ST111_GameType, MainWindowPtr, NULL);
- } elif (code == 'L')
- { ActivateGadget(ST111_Players, MainWindowPtr, NULL);
- } elif (code == 'H')
- { ActivateGadget(ST111_HDInstallable, MainWindowPtr, NULL);
- } elif (code == 'C')
- { ActivateGadget(ST111_Compatibility, MainWindowPtr, NULL);
- } elif (code == 'S')
- { ActivateGadget(ST111_Submission, MainWindowPtr, NULL);
- } elif (code == 'R')
- { ActivateGadget(gadgets[GID_11_TE1], MainWindowPtr, NULL);
- }
- } }
-
- AGLOBAL void newagdb(ABOOL display)
- { strcpy(agdb.title, "");
- strcpy(agdb.publisher, "");
- strcpy(agdb.gametype, "");
- strcpy(agdb.players, "");
- strcpy(agdb.hdinstallable, "");
- strcpy(agdb.compatibility, "");
- strcpy(aminet.uploader, "");
- strcpy(agdb.output, "");
- strcpy(agdb.textfield, "");
- agdb.loaded = FALSE;
-
- if (display)
- updateagdbgadgets();
- }
-
- AGLOBAL void openagdb(void)
- { if (asl())
- { strcpy(agdb.output, aslresult);
- loadagdb();
- updateagdbgadgets();
- } }
-
- AGLOBAL void loadagdb(void)
- { if (readin(agdb.output))
- { agdb.loaded = TRUE;
- offset = 0;
-
- parse("Title: ");
- parse("\nPublisher: ");
- strcpy(agdb.title, string);
- parse("\nGame Type: ");
- strcpy(agdb.publisher, string);
- parse("\nPlayers: ");
- strcpy(agdb.gametype, string);
- parse("\nHD Installable: ");
- strcpy(agdb.players, string);
- parse("\nCompatibility: ");
- strcpy(agdb.hdinstallable, string);
- parse("\nSubmission: ");
- strcpy(agdb.compatibility, string);
- parse("\n\nReview:\n");
- strcpy(aminet.uploader, string);
- parsetoend();
- strcpy(agdb.textfield, string);
-
- updateagdbgadgets();
- } }
-
- MODULE void updateagdbgadgets(void)
- { GT_SetGadgetAttrs
- ( ST111_Title,
- MainWindowPtr,
- NULL,
- GTST_String, agdb.title,
- TAG_DONE
- );
- GT_SetGadgetAttrs
- ( ST111_Publisher,
- MainWindowPtr,
- NULL,
- GTST_String, agdb.publisher,
- TAG_DONE
- );
- GT_SetGadgetAttrs
- ( ST111_GameType,
- MainWindowPtr,
- NULL,
- GTST_String, agdb.gametype,
- TAG_DONE
- );
- GT_SetGadgetAttrs
- ( ST111_Players,
- MainWindowPtr,
- NULL,
- GTST_String, agdb.players,
- TAG_DONE
- );
- GT_SetGadgetAttrs
- ( ST111_HDInstallable,
- MainWindowPtr,
- NULL,
- GTST_String, agdb.hdinstallable,
- TAG_DONE
- );
- GT_SetGadgetAttrs
- ( ST111_Compatibility,
- MainWindowPtr,
- NULL,
- GTST_String, agdb.compatibility,
- TAG_DONE
- );
- GT_SetGadgetAttrs
- ( ST111_Submission,
- MainWindowPtr,
- NULL,
- GTST_String, aminet.uploader,
- TAG_DONE
- );
-
- SetGadgetAttrs
- ( gadgets[GID_11_TE1], MainWindowPtr, NULL,
- GA_TEXTEDITOR_Contents, aminet.textfield,
- TAG_DONE
- );
- }
-
- MODULE void readagdbgadgets(void)
- { STRPTR textBuffer;
-
- strcpy
- ( agdb.title,
- ((struct StringInfo *) ST111_Title->SpecialInfo)->Buffer
- );
- strcpy
- ( agdb.publisher,
- ((struct StringInfo *) ST111_Publisher->SpecialInfo)->Buffer
- );
- strcpy
- ( agdb.gametype,
- ((struct StringInfo *) ST111_GameType->SpecialInfo)->Buffer
- );
- strcpy
- ( agdb.players,
- ((struct StringInfo *) ST111_Players->SpecialInfo)->Buffer
- );
- strcpy
- ( agdb.hdinstallable,
- ((struct StringInfo *) ST111_HDInstallable->SpecialInfo)->Buffer
- );
- strcpy
- ( agdb.compatibility,
- ((struct StringInfo *) ST111_Compatibility->SpecialInfo)->Buffer
- );
- strcpy
- ( aminet.uploader,
- ((struct StringInfo *) ST111_Submission->SpecialInfo)->Buffer
- );
-
- textBuffer = (STRPTR) DoGadgetMethod(gadgets[GID_11_TE1], MainWindowPtr, NULL, GM_TEXTEDITOR_ExportText, NULL);
- strcpy(agdb.textfield, textBuffer); // long description
- FreeVec((APTR) textBuffer);
- // textBuffer = NULL;
- }
-